﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HRM.BLL;
using HRM.DAL.DAO;

namespace HRM.UI.HRAdminUI.Profile
{
    public partial class ChangeAccountInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void ChangeAccount(object sender, EventArgs e)
        {
            UserManager userManager = new UserManager();
            Code code = new Code();
            code.CodeName = Session["Code"].ToString();
            Employee employee = new Employee();
            employee.EmpCode = code;
            User user = new User();
            user.Employee = employee;
            user.UserName = txtUsername.Value;
            user.Password = PsNew.Text;
            if (PsCurrent.Value == Session["Pass"].ToString())
            {
                if (userManager.ChangeUsernamePassword(user))
                {
                    msgLbl.Text = "Username and Password  Changed Successfully";
                    msgLbl.ForeColor = Color.Green;
                }
                else
                {
                    msgLbl.Text = "Username and Password Not Changed";
                    msgLbl.ForeColor = Color.Red;
                }

            }
        }
    }
}